<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>#{bundle.cuscor}</title>
        <link href="./resources/css/default.css" rel="stylesheet" type="text/css" /> 
    </h:head>
    <h:body>
        <ui:composition>
            
            <h:form >
                <script type="text/javascript">  
                    

                   

                    function handleSaveCuscor(xhr, status, args) {  
                        if(args.validationFailed || !args.success) {  
                            jQuery('#dialog').effect("shake", { times:3 }, 100);  
                        } else {  
                            dlgCuscor.hide();  
                        }  
                    }

                    function handleDeleteCuscor(xhr, status, args) {  
                        if(args.validationFailed || !args.success) {  
                            jQuery('#dialog').effect("shake", { times:3 }, 100);  
                        } else {  
                            dlgConfirmation.hide();  
                        }  
                    }
                    
                </script>  

                <p:toolbar>
                    <p:toolbarGroup align="left">
                        <p:commandButton value="#{bundle.btnNew}" image="ui-icon-document"
                                         action="#{cuscorBean.newData()}" rendered="#{menuBean.cekButtonAccess(2,'INS;')}"  
                                         oncomplete="dlgCuscor.show()" update=":#{utilityBean.findClientId('displayCuscor')}" process="@this">
                            <pe:resetEditableValues for="displayCuscor"/>
                        </p:commandButton>

                        <p:commandButton value="#{bundle.btnOpen}" oncomplete="dlgCuscor.show()" rendered="#{menuBean.cekButtonAccess(2,'OPN;')}"
                                         image="ui-icon-disk" actionListener="#{cuscorBean.openData()}"
                                         update=":#{utilityBean.findClientId('displayCuscor')}" > 
                        </p:commandButton>

                        <p:commandButton type="button" value="#{bundle.btnDelete}" image="ui-icon-trash" rendered="#{menuBean.cekButtonAccess(2,'DEL;')}"
                                         onclick="dlgConfirmation.show()" update=":#{utilityBean.findClientId('displayCuscor')}" />
                        <p:commandButton value="Refresh" icon="ui-icon-search" update=":#{utilityBean.findClientId('dtCuscors')}" 
                                         actionListener="#{cuscorBean.loadCuscors()}" ></p:commandButton>
                        <p:commandButton value="#{bundle.btnPrint}" image="ui-icon-print" rendered="#{menuBean.cekButtonAccess(2,'PRN;')}"
                                         action="#{RptTransaksiTabungan.doPrint()}" ajax="false"
                                         >
                          <!--  <p:fileDownload value="#{RptTransaksiTabungan.file}" /> -->
                        </p:commandButton>
                       <!-- <p:commandLink value="#{bundle.btnPrint}" rendered="#{menuBean.cekButtonAccess(2,'PRN;')}"
                                       action="#{RptTransaksiTabungan.doPrint()}" target="_blank" ajax="false">
                            <p:fileDownload value="#{RptTransaksiTabungan.file}" />
                        </p:commandLink> -->
                    </p:toolbarGroup>
                </p:toolbar>
                <br />
                <p:dataTable id="dtCuscors" var="cuscor" value="#{cuscorBean.cuscors}"
                             resizableColumns="true" rowIndexVar="noUrut" rowKey="#{cuscor.customer.customerId}"  
                             selection="#{cuscorBean.selectedData}" selectionMode="single"
                             paginator="true" rows="10" paginatorPosition="bottom" rowsPerPageTemplate="5,10,15,30"
                             paginatorTemplate="{CurrentPageReport} {PreviousPageLink} {NextPageLink} {RowsPerPageDropdown}" >
                 <p:column style="width: 10px" >
                    <f:facet name="header">No.</f:facet>
                    <h:outputText value="#{noUrut+1}" />
                 </p:column>
                    <p:column style="width: 100px" sortBy="#{cuscor.customer.cif}">
                        <f:facet name="header">#{bundle.cif}</f:facet>
                        <h:outputText value="#{cuscor.customer.cif}" />
                    </p:column>
                    <p:column style="width: 200px" sortBy="#{cuscor.customer.customerName}">
                        <f:facet name="header">#{bundle.globalName}</f:facet>
                        <h:outputText value="#{cuscor.customer.customerName}" />
                    </p:column>
                    <p:column style="width: 150px" sortBy="#{cuscor.customer.aliasName}">
                        <f:facet name="header">#{bundle.aliasName}</f:facet>
                        <h:outputText value="#{cuscor.customer.aliasName}" />
                    </p:column>
                    <p:column style="width: 300px" sortBy="#{cuscor.customer.idAddressLine1}">
                        <f:facet name="header">#{bundle.adress}</f:facet>
                        <h:outputText value="#{cuscor.customer.idAddressLine1}" />
                    </p:column>
                </p:dataTable>        

                <p:confirmDialog message="#{bundle.confirmDelete}" appendToBody="true" 
                                 header="#{bundle.confirmDeleteHeader}" severity="alert" widgetVar="dlgConfirmation">  
                    <p:commandButton value="#{bundle.btnYes}" update="dtCuscors" 
                                     oncomplete="handleDeleteCuscor(xhr, status, args)"  
                                     actionListener="#{cuscorBean.delete()}" />  
                    <p:commandButton value="#{bundle.btnCancel}" onclick="dlgConfirmation.hide()" type="button" />   
                </p:confirmDialog>

            </h:form>
                        
            <p:dialog header="#{bundle.cuscor}" widgetVar="dlgCuscor" closable="true" dynamic="true" style="top: -200px;left: -280px;" appendToBody="true" modal="true">
                    <p:ajax immediate="true" event="close" listener="#{cuscorBean.handleClose}"/>
                    <h:form>
                    <h:panelGrid id="displayCuscor" columns="2" styleClass="addELIT" >
                        <p:tabView activeIndex="0" rendered="#{cuscorBean.insertedData!=null}">
                            <p:tab title="#{bundle.globalInfo}" >
                                <h:panelGrid columns="3" cellpadding="0" cellspacing="5">
                                    <h:outputText value= "#{bundle.cif}"/><h:outputLabel value= ":" />
                                    <p:inputText value="#{cuscorBean.insertedData.customer.cif}" onkeyup="upperCase(this)"
                                                 style="width: 150px;" required="true" requiredMessage="#{bundle.cif} #{bundle.requiredInput}" >
                                        <p:ajax event="blur" listener="#{cuscorBean.handleCIFChange}" process="@this"/>
                                    </p:inputText>
                                    
                                    <h:outputText value= "#{bundle.custype}"/><h:outputLabel value= ":" />
                                    <p:selectOneMenu value="#{cuscorBean.insertedData.customer.custypeId}" 
                                                     style="width: 200px" required="true" requiredMessage="#{bundle.custype} #{bundle.requiredInput}">
                                        <f:selectItem itemLabel="#{bundle.custypeAnggotaLB}" itemValue="#{constantaBean.custypeAnggotaLb}"/>
                                        <f:selectItem itemLabel="#{bundle.custypeAnggota}" itemValue="#{constantaBean.custypeAnggota}"/>
                                    </p:selectOneMenu>
                                    <h:outputLabel value= "#{bundle.idcard}"/><h:outputLabel value= ":" />
                                    <h:panelGrid columns="2" cellpadding="0" cellspacing="0" width="100%">
                                        <p:selectOneMenu value="#{cuscorBean.insertedData.customer.idcardId}" style="width: 150px" required="false" requiredMessage="#{bundle.idcard} #{bundle.requiredInput}">
                                            <f:selectItem itemLabel="#{bundle.Select} #{bundle.idcard}" itemValue="-1" />
                                            <f:selectItems value="#{customerBean.availableIdCard}" />
                                        </p:selectOneMenu>

                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0" style="float:right;" >
                                            <h:outputLabel style="text-align:right;padding: 0 15px 0 0;" value= "#{bundle.idcardno} :" />
                                            <p:inputText value="#{cuscorBean.insertedData.customer.idcardNo}" onkeyup="upperCase(this)" style="float: right;" required="false"
                                                         requiredMessage="#{bundle.idcardno} #{bundle.requiredInput}" /> 
                                        </h:panelGrid>
                                    </h:panelGrid>    

                                    <h:outputLabel value= "#{bundle.globalName}"/><h:outputLabel value= ":" />
                                    <p:inputText value="#{cuscorBean.insertedData.customer.customerName}" onkeyup="upperCase(this)"
                                                    style="width: 450px;" required="true" requiredMessage="#{bundle.globalName} #{bundle.requiredInput}" />

                                    <h:outputLabel value= "#{bundle.aliasName}"/><h:outputLabel value= ":" />
                                    <p:inputText value="#{cuscorBean.insertedData.customer.aliasName}" style="width: 450px;" onkeyup="upperCase(this)"/>

                                    <h:outputLabel value= "#{bundle.phone}"/><h:outputLabel value= ":" />
                                    <h:panelGrid columns="2" cellpadding="0" cellspacing="0" width="100%">
                                        <p:inputText value="#{cuscorBean.insertedData.customer.phone}" style="margin-right: 20px" onkeyup="upperCase(this)"/>
                                        <!--<h:panelGrid columns="2" cellspacing="0" cellpadding="0" style="float:right;">
                                            <h:outputLabel style="text-align: left;padding: 0 15px 0 0;" value= "#{bundle.mobilePhone} :" />
                                            <p:inputText value="#{cuscorBean.insertedData.customer.mobilePhone}" style="float: right;" onkeyup="upperCase(this)"/>
                                        </h:panelGrid> -->
                                    </h:panelGrid>

                                    <h:outputLabel value= "#{bundle.email}"/><h:outputLabel value= ":" />
                                    <h:panelGrid columns="3" cellpadding="0" cellspacing="0" width="100%">
                                        <p:inputText value="#{cuscorBean.insertedData.customer.email}" size="40" onkeyup="upperCase(this)"/>

                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0" style="float:right;">
                                            <h:outputLabel style="text-align: left;padding: 0 15px 0 0;" value= "#{bundle.fax} :" />
                                            <p:inputText value="#{cuscorBean.insertedData.customer.fax}" style="float: right;" onkeyup="upperCase(this)"/>
                                        </h:panelGrid>
                                    </h:panelGrid>

                                    <h:outputLabel value= "#{bundle.npwp}"/><h:outputLabel value= ":" />
                                    <h:panelGrid columns="3" cellpadding="0" cellspacing="0" width="100%">
                                        <p:inputText value="#{cuscorBean.insertedData.customer.npwp}" onkeyup="upperCase(this)"/>
                                       <!-- <h:panelGrid columns="2" cellpadding="0" cellspacing="0" style="float:right;">
                                            <h:outputLabel style="text-align: left;padding: 0 15px 0 0;" value= "#{bundle.pin} :" />
                                            <p:inputText value="#{cuscorBean.insertedData.customer.pin}" style="float: right;" />
                                        </h:panelGrid>    -->
                                    </h:panelGrid>

                                   <!-- <h:outputLabel value= "#{bundle.fingerprint}"/><h:outputLabel value= ":" />
                                    <p:inputText value="#{cuscorBean.insertedData.customer.fingerPrint}" style="width: 450px;"/> -->
                                </h:panelGrid>
                            </p:tab>

                            <p:tab title="#{bundle.addressCompany}">
                                <h:panelGrid columns="3" cellpadding="1" columnClasses="panelGridId">
                                    <p:panel header="#{bundle.addressCompany}" >
                                        <h:panelGrid columns="3" cellpadding="0" cellspacing="5">
                                            <h:outputLabel value= "#{bundle.adress}" /><h:outputLabel value= ":" />
                                            <p:inputText value="#{cuscorBean.insertedData.customer.idAddressLine1}" onkeyup="upperCase(this)"
                                                        style="width: 230px;" required="true" requiredMessage="#{bundle.adress} #{bundle.requiredInput}" />

                                            <h:outputLabel value= " " /><h:outputLabel value= ":" />
                                            <p:inputText style="width: 230px;" value="#{cuscorBean.insertedData.customer.idAddressLine2}" onkeyup="upperCase(this)"/>

                                            <h:outputLabel value= " " /><h:outputLabel value= ":" />
                                            <p:inputText style="width: 230px;" value="#{cuscorBean.insertedData.customer.idAddressLine3}" onkeyup="upperCase(this)"/>

                                            <h:outputLabel value= "#{bundle.country}" /><h:outputLabel value= ":" />
                                            <p:selectOneMenu value="#{cuscorBean.insertedData.customer.idCountryId}" 
                                                            style="width: 150px;" required="true" requiredMessage="#{bundle.country} #{bundle.requiredInput}" >
                                                <f:selectItem itemLabel="#{bundle.Select} #{bundle.country}" itemValue="" />
                                                <f:selectItems value="#{customerBean.availableCountry}" var="country" />
                                                <p:ajax update="cmbProvince1c" listener="#{cuscorBean.handleCountryChange(cuscorBean.insertedData.customer.idCountryId)}" />
                                            </p:selectOneMenu>

                                            <h:outputLabel value= "#{bundle.province}" /><h:outputLabel value= ":" />
                                            <p:selectOneMenu id="cmbProvince1c" value="#{cuscorBean.insertedData.customer.idProvinceId}" 
                                                                style="width: 150px;" required="true" requiredMessage="#{bundle.province} #{bundle.requiredInput}" >
                                                <f:selectItem itemLabel="#{bundle.Select} #{bundle.province}" itemValue="" />
                                                <f:selectItems value="#{cuscorBean.availableProvince}" var="province" />
                                                <p:ajax update="cmbDistrict1c"  listener="#{cuscorBean.handleProvinceChange(cuscorBean.insertedData.customer.idProvinceId)}" />
                                            </p:selectOneMenu>

                                            <h:outputLabel value= "#{bundle.district}" /><h:outputLabel value= ":" />
                                            <p:selectOneMenu id="cmbDistrict1c" value="#{cuscorBean.insertedData.customer.idDistrictId}" 
                                                            style="width: 150px;" required="true" requiredMessage="#{bundle.district} #{bundle.requiredInput}" >
                                                <f:selectItem itemLabel="#{bundle.Select} #{bundle.district}" itemValue="" />
                                                <f:selectItems value="#{cuscorBean.availableDistrict}" var="district" />
                                            </p:selectOneMenu>

                                            <h:outputLabel value= "#{bundle.subdistrict}" /><h:outputLabel value= ":" />
                                            <p:inputText value="#{cuscorBean.insertedData.customer.idSubdistrict}" onkeyup="upperCase(this)"
                                                    style="width: 230px;" requiredMessage="#{bundle.subdistrict} #{bundle.requiredInput}" />            

                                            <h:outputLabel value= "#{bundle.village}" /><h:outputLabel value= ":" />
                                            <p:inputText value="#{cuscorBean.insertedData.customer.idVillage}" onkeyup="upperCase(this)"
                                                        style="width: 230px;" requiredMessage="#{bundle.subdistrict} #{bundle.requiredInput}" />

                                            <h:outputLabel value= "#{bundle.postcode}" /><h:outputLabel value= ":" />
                                            <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                                <p:inputText value="#{cuscorBean.insertedData.customer.idPostcode}" maxlength="5" style="margin-right: 15px; width: 50px;" onkeyup="upperCase(this)"/>
                                                <h:panelGrid columns="4">
                                                    <h:outputLabel style="padding:0 5px 0 0;" value= "#{bundle.rt} :" />
                                                    <p:inputText value="#{cuscorBean.insertedData.customer.idRt}" style="margin-right: 15px; width: 25px;" onkeyup="upperCase(this)"/>
                                                    <h:outputLabel style="padding:0 5px 0 0;" value= "#{bundle.rw} :" />
                                                    <p:inputText value="#{cuscorBean.insertedData.customer.idRw}" style="margin-right: 15px; width: 25px;" onkeyup="upperCase(this)"/>
                                                </h:panelGrid>
                                            </h:panelGrid>
                                        </h:panelGrid>
                                    </p:panel>

                                 <!--   <p:panel header="#{bundle.addressRes}">
                                        <h:panelGrid columns="3" cellpadding="0" cellspacing="5">
                                            <h:outputLabel value= "#{bundle.restatus}" /><h:outputLabel value= ":" />
                                            <p:selectOneMenu value="#{cuscorBean.insertedData.customer.restatusId}" 
                                                            style="width: 150px" required="true" requiredMessage="#{bundle.restatus} #{bundle.requiredInput}" >
                                                <f:selectItem itemLabel="#{bundle.Select} #{bundle.restatus}" itemValue="" />
                                                <f:selectItems value="#{customerBean.availableRestatus}"/>
                                            </p:selectOneMenu>

                                            <h:outputLabel value= "#{bundle.adress}" /><h:outputLabel value= ":" />
                                            <p:inputText style="width: 230px;" value="#{cuscorBean.insertedData.customer.resAddressLine1}" onkeyup="upperCase(this)"/>

                                            <h:outputLabel value= " " /><h:outputLabel value= ":" />
                                            <p:inputText style="width: 230px;" value="#{cuscorBean.insertedData.customer.resAddressLine2}" onkeyup="upperCase(this)"/>

                                            <h:outputLabel value= " " /><h:outputLabel value= ":" />
                                            <p:inputText style="width: 230px;" value="#{cuscorBean.insertedData.customer.resAddressLine3}" onkeyup="upperCase(this)"/>

                                            <h:outputLabel value= "#{bundle.country}" /><h:outputLabel value= ":" />
                                            <p:selectOneMenu value="#{cuscorBean.insertedData.customer.resCountryId}"
                                                            style="width: 150px" required="true" requiredMessage="#{bundle.country} #{bundle.requiredInput}">
                                                <f:selectItem itemLabel="#{bundle.Select} #{bundle.country}" itemValue="" />
                                                <f:selectItems value="#{customerBean.availableCountry}" />
                                                <p:ajax update="cmbProvince2c"  listener="#{cuscorBean.handleRescountryChange(cuscorBean.insertedData.customer.resCountryId)}" />
                                            </p:selectOneMenu>

                                            <h:outputLabel value= "#{bundle.province}" /><h:outputLabel value= ":" />
                                            <p:selectOneMenu id="cmbProvince2c" value="#{cuscorBean.insertedData.customer.resProvinceId}" 
                                                                style="width: 150px" required="true" requiredMessage="#{bundle.province} #{bundle.requiredInput}">
                                                <f:selectItem itemLabel="#{bundle.Select} #{bundle.province}" itemValue="" />
                                                <f:selectItems value="#{cuscorBean.availableProvince}" />
                                                <p:ajax update="cmbDistrict2c"  listener="#{cuscorBean.handleResprovinceChange(cuscorBean.insertedData.customer.resProvinceId)}" />
                                            </p:selectOneMenu>

                                            <h:outputLabel value= "#{bundle.district}" /><h:outputLabel value= ":" />
                                            <p:selectOneMenu id="cmbDistrict2c" value="#{cuscorBean.insertedData.customer.resDistrictId}" 
                                                                    style="width: 150px" required="true" requiredMessage="#{bundle.district} #{bundle.requiredInput}">
                                                <f:selectItem itemLabel="#{bundle.Select} #{bundle.district}" itemValue="" />
                                                <f:selectItems value="#{cuscorBean.availableDistrict}" var="district2" />
                                            </p:selectOneMenu>

                                            <h:outputLabel value= "#{bundle.subdistrict}" /><h:outputLabel value= ":" />
                                            <p:inputText value="#{cuscorBean.insertedData.customer.resSubdistrict}" onkeyup="upperCase(this)"/>

                                            <h:outputLabel value= "#{bundle.village}" /><h:outputLabel value= ":" />
                                            <p:inputText style="width: 230px" value="#{cuscorBean.insertedData.customer.resVillage}" onkeyup="upperCase(this)"/>                                             

                                            <h:outputLabel value= "#{bundle.postcode}" /><h:outputLabel value= ":" />
                                            <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                                <p:inputText value="#{cuscorBean.insertedData.customer.resPostcode}" style="margin-right: 15px; width: 50px;" onkeyup="upperCase(this)"/>
                                                <h:panelGrid columns="4">
                                                    <h:outputLabel style="padding:0 5px 0 0;" value= "#{bundle.rt} :" />
                                                    <p:inputText value="#{cuscorBean.insertedData.customer.resRt}" style="margin-right: 15px; width: 25px;" onkeyup="upperCase(this)"/>
                                                    <h:outputLabel style="padding:0 5px 0 0;" value= "#{bundle.rw} :" />
                                                    <p:inputText value="#{cuscorBean.insertedData.customer.resRw}" style="margin-right: 15px; width: 25px;" onkeyup="upperCase(this)"/>
                                                </h:panelGrid>
                                            </h:panelGrid>
                                        </h:panelGrid>    
                                    </p:panel> -->
                                </h:panelGrid>
                            </p:tab>

                            <p:tab title="#{bundle.company}">
                                <h:panelGrid columns="3" cellpadding="0" cellspacing="5">
                                    <h:outputLabel value= "#{bundle.busentTpye}" /><h:outputLabel value= ":" />
                                    <p:selectOneMenu value="#{cuscorBean.insertedData.busentypeId}" style="width: 200px" 
                                                     required="false" requiredMessage="#{bundle.busentTpye} #{bundle.requiredInput}">
                                        <f:selectItem itemLabel="#{bundle.Select} #{bundle.busentTpye}" itemValue="-1" />
                                        <f:selectItems value="#{cuscorBean.availableBusentype}" />
                                    </p:selectOneMenu>
                                    
                                    <h:outputLabel value= "#{bundle.busentypeRemark}" /><h:outputLabel value= ":" />
                                    <p:inputText value="#{cuscorBean.insertedData.busentypeRemark}" style="width: 200px" onkeyup="upperCase(this)"
                                                 required="false" requiredMessage="#{bundle.busentypeRemark} #{bundle.requiredInput}"/>

                                    <h:outputLabel value= "#{bundle.establishLocation}" /><h:outputLabel value= ":" />
                                    <p:inputText   value="#{cuscorBean.insertedData.establishedLocation}" style="width: 200px" onkeyup="upperCase(this)"/>

                                    <h:outputLabel value= "#{bundle.establishDate}" /><h:outputLabel value= ":" />
                                    <p:calendar pattern="dd/MM/yyyy" size="8"  value="#{cuscorBean.insertedData.establishedDate}" /> 

                                    <h:outputLabel value= "#{bundle.corebus}" /><h:outputLabel value= ":" />
                                    <p:selectOneMenu value="#{cuscorBean.insertedData.corebussinesId}" style="width: 200px" >
                                        <f:selectItem itemLabel="#{bundle.Select} #{bundle.corebus}" itemValue="" />
                                        <f:selectItems value="#{cuscorBean.availableCorebus}" var="corebus" />
                                    </p:selectOneMenu>

                                    <h:outputLabel value= "#{bundle.headCompany}" /><h:outputLabel value= ":" />
                                    <p:inputText  value="#{cuscorBean.insertedData.headCompanyName}" style="width: 200px" onkeyup="upperCase(this)"/>

                                    <h:outputLabel value= "#{bundle.authorizedCapital}" /><h:outputLabel value= ":" />
                                    <pe:inputNumber decimalPlaces="2" decimalSeparator="." thousandSeparator="," maxValue="99999999999999999999.99" minValue="0"
                                            styleClass="money"  value="#{cuscorBean.insertedData.authorizedCapital}" style="width: 200px">
                                    </pe:inputNumber>

                                    <h:outputLabel value= "#{bundle.numOfEmployees}" /><h:outputLabel value= ":" />
                                    <pe:inputNumber decimalPlaces="0" decimalSeparator="." thousandSeparator="," maxValue="999999" minValue="0"
                                        styleClass="integer"  value="#{cuscorBean.insertedData.numOfEmployees}" style="width: 200px">
                                    </pe:inputNumber>
                                </h:panelGrid>
                            </p:tab>
                            
                            <p:tab title="#{bundle.corbodTitle}">
                                <pe:masterDetail id="corbodMD" selectLevelListener="#{selectLevelListener.handleNavigation}" style="width: 700px;">
                                <pe:masterDetailLevel level="1" levelLabel="#{bundle.corbod}">
                                    <p:outputPanel autoUpdate="true">
                                        <p:dataTable id="dtcorbods" var="corbod" value="#{cuscorBean.insertedData.customer.corbods}" rowIndexVar="noUrut3" 
                                                     rendered="#{cuscorBean.insertedData != null}" scrollable="true" scrollWidth="700" resizableColumns="true" >
                                            <p:column style="width: 11px;">
                                                <f:facet name="header">No</f:facet>
                                                    <h:outputText value="#{noUrut3+1}" styleClass="numPos" >
                                                        <f:convertNumber groupingUsed="true"/>
                                                    </h:outputText>
                                            </p:column>

                                            <p:column style="width: 100px;">
                                                <f:facet name="header">#{bundle.directorName}</f:facet>
                                                <h:outputText value="#{corbod.directorName}" />
                                            </p:column>
        
                                            <p:column style="width: 70px;">
                                                <f:facet name="header">#{bundle.jobTitle}</f:facet>
                                                <h:outputText value="#{corbod.jobTitle}" />
                                            </p:column>
                                            <p:column style="width: 75px;">
                                                <f:facet name="header">#{bundle.birthPlace}</f:facet>
                                                <h:outputText value="#{corbod.birthPlace}" />
                                            </p:column>
                                            <p:column style="width: 75px;">
                                                <f:facet name="header">#{bundle.birthDate}</f:facet>
                                                <h:outputText value="#{corbod.birthDate}" />
                                            </p:column>
                                            <p:column style="width: 150px;">
                                                <f:facet name="header">#{bundle.addressRes}</f:facet>
                                                <h:outputText value="#{corbod.addressLine1}" />
                                            </p:column>
        
                                            <p:column style="width: 75px;">
                                                <f:facet name="header">#{bundle.idcardno}</f:facet>
                                                <h:outputText value="#{corbod.idcardNo}" />
                                            </p:column>
        
                                            <p:column style="width: 75px;">
                                                <f:facet name="header">#{bundle.nationality}</f:facet>
                                                <h:outputText value="#{cuscorBean.selectItemValueOf(cuscorBean.availableNationality, corbod.nationalityId)}" />
                                            </p:column>
                                            <p:column style="width: 50px;">
                                                <f:facet name="header">#{bundle.pic}</f:facet>
                                                <h:outputText value="#{corbod.pic}" />
                                            </p:column>
        
                                            <p:column style="width:70px">
                                                <f:facet name="header">Actions</f:facet>
                                                <p:commandLink value="Add" actionListener="#{cuscorBean.newBoard()}" >
                                                    <pe:selectDetailLevel contextValue="#{null}" preserveInputs="true"/>
                                                </p:commandLink><p:spacer width="3"/>

                                                <p:commandLink value="Edit" actionListener="#{cuscorBean.editBoard(corbod)}" >
                                                    <pe:selectDetailLevel contextValue="#{corbod}" preserveInputs="true"/>
                                                </p:commandLink><p:spacer width="3"/>

                                                <p:commandLink value="Del" actionListener="#{cuscorBean.handleRemoveBoard()}" >
                                                    <p:collector value="#{corbod}" removeFrom="#{cuscorBean.insertedData.customer.corbods}" />  
                                                </p:commandLink>
                                            </p:column>
                                        </p:dataTable>
                                    </p:outputPanel>
                                </pe:masterDetailLevel>
                                
                                <pe:masterDetailLevel level="2" levelLabel="Add/edit" contextVar="corbod" >
                                    <h:panelGrid id="frmCorbord" columns="3" border="0" cellpadding="0" cellspacing="5" >
                                        
                                        <h:outputLabel value= "#{bundle.directorName}" /><h:outputLabel value=":"/>
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                            <p:inputText value="#{cuscorBean.unsaveboard.directorName}" style="width: 150px;"
                                                id="boardDirectorName" required="true" label="#{bundle.directorName}" onkeyup="upperCase(this)"
                                                requiredMessage="#{bundle.directorName} #{bundle.requiredInput}">
                                                <p:ajax update="msgboardDirectorName" process="@this" /> 
                                            </p:inputText>
                                            <p:message id="msgboardDirectorName" for="boardDirectorName" display="icon" />
                                        </h:panelGrid>
                                                                                
                                        <h:outputLabel value= "#{bundle.jobTitle}" /><h:outputLabel value=":"/>
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                            <p:inputText value="#{cuscorBean.unsaveboard.jobTitle}" style="width: 150px;"
                                                id="boardJobTitle" required="true" label="#{bundle.jobTitle}" onkeyup="upperCase(this)"
                                                requiredMessage="#{bundle.jobTitle} #{bundle.requiredInput}">
                                                <p:ajax update="msgboardJobTitle" process="@this" /> 
                                            </p:inputText>
                                            <p:message id="msgboardJobTitle" for="boardJobTitle" display="icon" />
                                        </h:panelGrid>
                                        <h:outputLabel value= "#{bundle.birthPlace}" /><h:outputLabel value=":"/>
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                            <p:inputText value="#{cuscorBean.unsaveboard.birthPlace}" style="width: 150px;"
                                                         id="boardBirthPlace" required="false" label="#{bundle.birthPlace}" onkeyup="upperCase(this)"
                                                         requiredMessage="#{bundle.birthPlace} #{bundle.requiredInput}">
                                                 <p:ajax update="msgboardJobTitle" process="@this" />  
                                            </p:inputText>
                                            <p:message id="msgboardBirthPlace" for="boardBirthPlace" display="icon" />
                                        </h:panelGrid>
                                        <h:outputLabel value= "#{bundle.birthDate}" /><h:outputLabel value=":"/>
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                            <p:calendar pattern="dd/MM/yyyy" size="8" showOn="button" value="#{cuscorBean.unsaveboard.birthDate}"/> 
                                                <!-- <p:ajax update="msgboardJobTitle" process="@this" />  -->
                                            
                                           <!-- <p:message id="msgboardJobTitle" for="boardJobTitle" display="icon" /> -->
                                        </h:panelGrid>
                                        <h:outputLabel value= "#{bundle.adress}" /><h:outputLabel value= ":" />
                                        <p:inputText  size="40" value="#{cuscorBean.unsaveboard.addressLine1}" onkeyup="upperCase(this)"/>
                                        <h:outputLabel value= "#{bundle.idcardno}" /><h:outputLabel value=":"/>
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                            <p:inputText value="#{cuscorBean.unsaveboard.idcardNo}" style="width: 150px;"
                                                id="boardIdcardno" required="true" label="#{bundle.idcardno}" onkeyup="upperCase(this)"
                                                requiredMessage="#{bundle.idcardno} #{bundle.requiredInput}">
                                                <p:ajax update="msboardIdcardno" process="@this" /> 
                                            </p:inputText>
                                            <p:message id="msboardIdcardno" for="boardIdcardno" display="icon" />
                                        </h:panelGrid>
                                                                                
                                        <h:outputLabel value= "#{bundle.nationality}" /><h:outputLabel value=":"/>
                                        <p:selectOneMenu value="#{cuscorBean.nationalityId}" style="width: 150px;" >
                                            <f:selectItems value="#{cuscorBean.availableNationality}" />
                                        </p:selectOneMenu>
                                        <h:outputLabel style="padding:0 15px 0 0;" value= "#{bundle.pic}" /><h:outputLabel value=":"/>
                                        <p:selectBooleanCheckbox value="#{cuscorBean.unsaveboard.pic}" />
                                    </h:panelGrid>
                                    
                                    <h:panelGrid cellpadding="0" >
                                        <f:facet name="footer">  
                                            <p:commandButton value="Back" icon="ui-icon ui-icon-arrowthick-1-w" process="@this">
                                                <pe:resetEditableValues for="frmCorbord"/>  
                                                <pe:selectDetailLevel step="-1"/>
                                            </p:commandButton>
                                            
                                            <p:commandButton value="#{bundle.btnSave}" icon="ui-icon-disk" actionListener="#{cuscorBean.saveBoard()}"/>
                                            
                                            <p:commandButton value="#{bundle.btnNew}" icon="ui-icon-document" actionListener="#{cuscorBean.newBoard()}"  
                                                             process="@this" update="frmCorbord">
                                                <pe:resetEditableValues for="frmCorbord"/>  
                                            </p:commandButton>  
                                            
                                        </f:facet>
                                    </h:panelGrid>
                                </pe:masterDetailLevel>
                                </pe:masterDetail>
                            </p:tab>
                            
                            <p:tab title="#{bundle.corbuslic}">
                                <pe:masterDetail id="corbuslicdMD" selectLevelListener="#{selectLevelListener.handleNavigation}" style="width: 600px;">
                                    <pe:masterDetailLevel level="1" levelLabel="#{bundle.buslic}">
                                    <p:outputPanel autoUpdate="true">
                                        <p:dataTable id="dtcorbuslic" var="buslic" value="#{cuscorBean.insertedData.customer.corbuslics}" rowIndexVar="noUrut4" 
                                                     rendered="#{cuscorBean.insertedData != null}">
                                            <p:column style="width: 11px;">
                                                <f:facet name="header">No</f:facet>
                                                    <h:outputText value="#{noUrut4+1}" styleClass="numPos" >
                                                        <f:convertNumber groupingUsed="true"/>
                                                    </h:outputText>
                                            </p:column>

                                            <p:column style="width: auto;">
                                                <f:facet name="header">#{bundle.buslic}</f:facet>
                                                <h:outputText value="#{cuscorBean.selectItemValueOf(cuscorBean.availableBuslic, buslic.buslicId)}" />
                                            </p:column>
        
                                            <p:column style="width: auto;">
                                                <f:facet name="header">#{bundle.buslicNo}</f:facet>
                                                <h:outputText value="#{buslic.buslicNo}" />
                                            </p:column>
        
                                            <p:column style="width: auto;">
                                                <f:facet name="header">#{bundle.expiryDate}</f:facet>
                                                <h:outputText value="#{buslic.expiryDate}" />
                                            </p:column>
        
                                            <p:column style="width:70px">
                                                <f:facet name="header">Actions</f:facet>
                                                <p:commandLink value="Add" actionListener="#{cuscorBean.newBuslic()}" >
                                                    <pe:selectDetailLevel contextValue="#{null}" preserveInputs="true"/>
                                                </p:commandLink><p:spacer width="3"/>

                                                <p:commandLink value="Edit" actionListener="#{cuscorBean.editBuslic(buslic)}" >
                                                    <pe:selectDetailLevel contextValue="#{buslic}" preserveInputs="true"/>
                                                </p:commandLink><p:spacer width="3"/>

                                                <p:commandLink value="Del" actionListener="#{cuscorBean.handleRemoveBuslic()}" >
                                                    <p:collector value="#{buslic}" removeFrom="#{cuscorBean.insertedData.customer.corbuslics}" />  
                                                </p:commandLink>
                                            </p:column>
                                        </p:dataTable>
                                    </p:outputPanel>
                                </pe:masterDetailLevel>
                                
                                <pe:masterDetailLevel level="2" levelLabel="Add/edit" contextVar="buslic" >
                                    <h:panelGrid id="frmCorbuslic" columns="3" border="0" cellpadding="0" cellspacing="5" >
                                        
                                        <h:outputLabel value= "#{bundle.buslic}" /><h:outputLabel value=":"/>
                                        <p:selectOneMenu value="#{cuscorBean.buslicId}" style="width: 150px;" >
                                            <f:selectItems value="#{cuscorBean.availableBuslic}" />
                                        </p:selectOneMenu>
                                        
                                        <h:outputLabel value= "#{bundle.buslicNo}" /><h:outputLabel value=":"/>
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                            <p:inputText value="#{cuscorBean.unsaveBuslic.buslicNo}" style="width: 150px;"
                                                id="corbuslicbuslicName" required="false" label="#{bundle.buslicNo}"
                                                requiredMessage="#{bundle.buslicNo} #{bundle.requiredInput}">
                                                <p:ajax update="msgcorbuslicbuslicName" process="@this" /> 
                                            </p:inputText>
                                            <p:message id="msgcorbuslicbuslicName" for="corbuslicbuslicName" display="icon" />
                                        </h:panelGrid>
                                                                                
                                        <h:outputLabel value= "#{bundle.expiryDate}" /><h:outputLabel value=":"/>
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                             <p:calendar value="#{cuscorBean.unsaveBuslic.expiryDate}" pattern="dd/MM/yyyy" showOn="button" />
                                        </h:panelGrid>
                                        
                                    </h:panelGrid>
                                    
                                    <h:panelGrid cellpadding="0" >
                                        <f:facet name="footer">  
                                            <p:commandButton value="Back" icon="ui-icon ui-icon-arrowthick-1-w" process="@this">
                                                <pe:resetEditableValues for="frmCorbuslic"/>  
                                                <pe:selectDetailLevel step="-1"/>
                                            </p:commandButton>
                                            
                                            <p:commandButton value="#{bundle.btnSave}" icon="ui-icon-disk" actionListener="#{cuscorBean.saveBuslic()}"/>
                                            
                                            <p:commandButton value="#{bundle.btnNew}" icon="ui-icon-document" actionListener="#{cuscorBean.newBuslic()}"  
                                                             process="@this" update="frmCorbuslic">
                                                <pe:resetEditableValues for="frmCorbuslic"/>  
                                            </p:commandButton>  
                                            
                                        </f:facet>
                                    </h:panelGrid>
                                </pe:masterDetailLevel>
                                </pe:masterDetail>
                            </p:tab>
                             <p:tab title="#{bundle.specimen}">
                            <p:fileUpload value="#{cuscorBean.uploadedFile}" rendered="#{cuscorBean.insertedData!=null}" mode="advanced"
                                          allowTypes="/(\.|\/)(gif|jpe?g|png)$/" sizeLimit="100000" fileUploadListener="#{cuscorBean.handleFileUpload}">
                            </p:fileUpload>
                             <p:graphicImage  id="imgSpecimen" value="/upload/corporate/#{cuscorBean.insertedData.customer.specimen}" rendered="#{cuscorBean.insertedData!=null}"/>    
                        </p:tab>
                        </p:tabView>
                    </h:panelGrid>
                    <h:panelGrid cellpadding="0" styleClass="pComBtnSTDR">
                        <f:facet name="footer">
                            <p:commandButton value="#{bundle.btnSave}" image="ui-icon-disk" action="#{cuscorBean.trySave()}"
                                             update=":#{utilityBean.findClientId('dtCuscors')}" id="submitCuscor" rendered="#{menuBean.cekButtonAccess(2,'UPD;')}"
                                            oncomplete="handleSaveCuscor(xhr, status, args)"/>
                            <p:commandButton value="#{bundle.btnClose}" oncomplete="dlgCuscor.hide()" image="ui-icon-document" process="@this">
                                <pe:resetEditableValues for="displayCuscor"/>
                            </p:commandButton>
                        </f:facet>
                    </h:panelGrid>                    
                  <!--  <p:defaultCommand target="submitCuscor" /> -->
                    </h:form>
                </p:dialog>
            
        </ui:composition>
    </h:body>
</html>